package myjava.innerclassi;

public class Root2 {

   public static void main(String[] args) {

      int n = 10;
      while (n > 0) {
         n--;
         Hackmut.print();
      }
   }
}

class Hackmut {

   static int n = 0;

   static void print() {

      Book b = new Book("Ask the dust", "One night I was sitting on the bed in my hotel room on Bunker Hill, Down in the very middle of Los Angeles ...");
      System.out.println("title: " + b.getTitle());
      System.out.println("content: " + b.getContent());
      System.out.println("Printed so far: " + (++Hackmut.n));
   }

   /*
   - possono comunque essere istanziate ma solo da metodi statici della outer
   - non possono accedere ai membri di istanza della outer */
   private static class Book {

      private String title;
      private String content;
      
      public Book(String t, String c) {
         this.title = t;
         this.content = c;
      }

      public String getTitle() {
         return this.title;
      }

      public String getContent() {
         return this.content;
      }
   }
}